/**
 * POI (Place of interest) model
 */
define(
["osm/OsmInfo", "entity/IndoorMgr", "ui/QueryViewComp"],
function(OsmInfo, IndoorMgr, QueryViewComp) {
	return {
		create: function() {

			function _init(data, parentIndoorMgr, POIRendererMgr, systemMgr) {
				_renderer 	= POIRendererMgr.createRenderer(data);
				_osmInfo 	= OsmInfo.create().init(systemMgr, data.osmInfo);
				if(data.floors) {
					_indoorMgr = IndoorMgr.create().init(
						data.floors, _self, systemMgr
					);
				}
				_parentIndoorMgr = parentIndoorMgr;
				_queryViewComp = QueryViewComp.create().init(systemMgr, _self);

				return this;
			}

			function _destroy() {
				_renderer.destroy();
				_osmInfo.destroy();
				_indoorMgr.destroy();
				_queryViewComp.destroy();
				_parentIndoorMgr = null;
			}

			function _getRenderer() {
				return _renderer;
			}

			function _getIndoorMgr() {
				return _indoorMgr;
			}

			function _getParentIndoorMgr() {
				return _parentIndoorMgr;
			}

			function _getOsmInfo() {
				return _osmInfo;
			}

			var _self = {
				init: _init,
				destroy: _destroy,

				getRenderer: _getRenderer,
				getIndoorMgr: _getIndoorMgr,
				getParentIndoorMgr: _getParentIndoorMgr,
				getOsmInfo: _getOsmInfo,
			};

			//Privates
			var _renderer;
			var _indoorMgr;
			var _parentIndoorMgr;
			var _osmInfo;
			var _queryViewComp;

			//Returns
			return _self;
		}
	}
});